package com.yyds.controller;


import com.yyds.common.MyJSON;
import com.yyds.common.R;
import com.yyds.pojo.HospitalHospital;
import com.yyds.service.HospitalHospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/admin/hospital/hospital")
@SuppressWarnings({"all"})
public class HospitalHospitalController {


    @Autowired
    @Qualifier("HospitalHospitalService")
    private HospitalHospitalService hospitalHospitalService;

    //查询全部医院
    @RequestMapping("/queryAllHospital")
    public MyJSON<HospitalHospital> hospitalPageData(@RequestParam Map<String,Object> params){
        return hospitalHospitalService.queryHospitalHospitalService(params);
    }
    //添加医院信息
    @RequestMapping("/insertHospital")
    public R insertHospitalHospitalController(HospitalHospital hospital){
       Integer i = hospitalHospitalService.insertHospitalHospitalService(hospital);
       return i > 0 ? R.ok() : R.error();
    }
    //删除医院信息
    @RequestMapping("/deleteHospital")
    public R deleteHospitalHospitalController(Integer hospital_id){
        Integer i = hospitalHospitalService.deleteHospitalHospitalService(hospital_id);
        return i > 0 ? R.ok() : R.error();
    }

    //修改医院信息
    @RequestMapping("/updateHospital")
    public R updateHospitalHospitalController(HospitalHospital newHospital){
        System.out.println(""+newHospital);
        Integer i = hospitalHospitalService.updateHospitalHospitalService(newHospital);
        return i > 0 ? R.ok() : R.error();
    }


}
